/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kallsonys.session;

import com.kallsonys.object.OrderOms;
import com.kallsonys.object.Orderquote;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author alladiab
 */
@Stateless
public class OrderquoteFacade extends AbstractFacade<Orderquote> {
    @PersistenceContext(unitName = "Kallsonys-WarPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public OrderquoteFacade() {
        super(Orderquote.class);
    }
    
    /**
     * Obtiene x Order Id
     * @param idOrder
     * @return 
     */
    public List<Orderquote> getByIdOrder(long idOrder)
    {
        List<Orderquote> c = null;

        Query queryfindByProductidproduct = em.createNamedQuery("Orderquote.findByOrderid");
        queryfindByProductidproduct.setParameter("orderid", new OrderOms(idOrder));
        c = (List<Orderquote>) queryfindByProductidproduct.getResultList();
                
        return c;
    }
    /*
      public OrderOms getByOrderId(long orderID) {
        OrderOms c = null;

        Query queryfindByProductidproduct = em.createNamedQuery("OrderOms.findByOrderid");
        queryfindByProductidproduct.setParameter("orderid", orderID);
        c = (OrderOms) queryfindByProductidproduct.getSingleResult();
        return c;
    }
     1*/
}
